/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Achie
 */
@Entity
@Table(name = "Payment")
public class Payment {
    
    @Id
    @GeneratedValue
    @Column(name = "id")
    private long id;
    @Column(name = "creditcardnumber")
    private String creditcardNumber;
    @Column(name = "payment_date")
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date date;
    @ManyToOne
    private Student student;
    @ManyToOne
    private Paymethod method;
    
    public Payment() {
        
    }
    
    public Payment(long id, String creditcardNumber, Student stu) {
        this.setId(id);
        this.setDate();
        this.setCreditcardNumber(creditcardNumber);
        this.setStudent(stu);
    }

    /**
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return the creditcardNumber
     */
    public String getCreditcardNumber() {
        return creditcardNumber;
    }

    /**
     * @param creditcardNumber the creditcardNumber to set
     */
    public void setCreditcardNumber(String creditcardNumber) {
        this.creditcardNumber = creditcardNumber;
    }
    
    public void setDate() {
        Date date = new Date();
        this.date = date;
    }
    
    public Date getDate() {
        return date;
    }

    /**
     * @return the student
     */
    public Student getStudent() {
        return student;
    }

    /**
     * @param student the student to set
     */
    public void setStudent(Student student) {
        this.student = student;
    }

    public Paymethod getMethod() {
        return method;
    }

    public void setMethod(Paymethod method) {
        this.method = method;
    }
    
}
